import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import getters from './getters'
import theme from './modules/theme'
import user from './modules/user'
import permission from '@/store/modules/permission'
import navtabs from '@/store/modules/navtabs'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    theme,
    permission,
    user,
    navtabs
  },
  getters,
  plugins: [createPersistedState({
    paths: ['navtabs', 'permission.activeMenu', 'permission.activeApp'],
    storage: window.sessionStorage
  })]
})

export default store
